Haarlem is on the main train line between Amsterdam and The Hague. It takes about 15 minutes to travel from Amsterdam by train. If you have – or rent – a bike, it takes between an hour and an hour and a half to cycle depending on the cyclist from the centre of Amsterdam, a fairly relaxing ride on typically level terrain.
If you're taking the train from Schiphol Airport, there is no direct service so you will have to change trains in Amsterdam or Sloterdijk. Trains are easy to use and you may be lucky enough to encounter one or more of the most entertaining ticket collectors in the country. They number singers and magicians amongst their members.
A good alternative is to use the big red bus 300, called the Zuidtangent, which runs every 6-10 minutes between Schiphol and Haarlem Central Station. There are a fair amount of stops along the way, but for a lot of the journey there is no traffic because the bus has its own dedicated lane. The trip is approximately 30-40 minutes. You will need to carry your luggage on the bus with you. You pay with a OV chipcard or a strippenkaart, a ticket that you feed into a punch machine when you board the bus. The strippenkaart costs just a few euros, and is available from the newsagent's on your left just before you exit the Schiphol terminal out into the bus pickup area. There are many bus stops clustered in this area -- the one for the Zuidtangent is across the street, and is indicated on the sign at the bus stop. From sometime in 2010, the Strippenkaart is no longer accepted on the 300 bus. OV card or cash only 4 euro single, good idea to have the exact change ready.